package YAPserver.mods;

import YAPenvironment.YAPconstant.ModState;
import YAPenvironment.YAPconstant.SideState;
import YAPserver.behaviours.CollideBallBounce;
import YAPserver.behaviours.CollideWall;
import YAPserver.gameObjects.Mod;
import YAPserver.logic.GameModifier;
import YAPserver.logic.Player;
/**
 * A local ModBehaviour.
 * When this modBehaviour's modify method is called the specified player receives a safety net which allows a gameBall to bounce off this player's 
 * wall once. When this happens the demodify method is called and the player no longer has a safety net.
 * @author Daniel
 *
 */
public class ModSafetyNet extends AbstractStandardMod{

	@Override
	public void modify(Mod mod, GameModifier gameMod, Player player) {
		super.modify(mod, gameMod, player);
		CollideBallBounce col = new CollideBallBounce();
		col.setMod(mod);
		player.setWallBehaviour(col);
		player.getWall().setColour(SideState.modWall);
	}

	@Override
	public void deModify(Mod mod, GameModifier gameMod, Player player) {
		//set back to normal collision
		player.setWallBehaviour(new CollideWall());
		player.getWall().setColour(SideState.none);
	}

	@Override
	public ModState getType() {
		return ModState.player;
	}

}
